package com.luomo.wenyuan.modules.wenyuan.controller;

import com.luomo.wenyuan.common.utils.PageUtils;
import com.luomo.wenyuan.common.utils.R;
import com.luomo.wenyuan.modules.wenyuan.entity.TSupplierEntity;
import com.luomo.wenyuan.modules.wenyuan.service.TSupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;


/**
 * 
 *
 * @author
 * @email
 * @date 2020-10-19 15:58:39
 */
@RestController
@RequestMapping("generator/tsupplier")
public class TSupplierController {
    @Autowired
    private TSupplierService tSupplierService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tSupplierService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		TSupplierEntity tSupplier = tSupplierService.getById(id);

        return R.ok().put("tSupplier", tSupplier);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody TSupplierEntity tSupplier){
		tSupplierService.save(tSupplier);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody TSupplierEntity tSupplier){
		tSupplierService.updateById(tSupplier);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		tSupplierService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
